package com.hyq.state.currency;
/**
* @ClassName: Context 
* @Description: 具体环境角色
* @author Janus
 */
public class Context {
	/**
	 * 定义两种状态
	 */
	public final static State state1=new ConcreteState1();
	
	public final static State state2=new ConcreteState2();
	/*
	 * 设置当前状态
	 */
	private State currentState;

	public State getCurrentState() {
		return currentState;
	}

	public void setCurrentState(State currentState) {
		this.currentState = currentState;
		//切换状态
		this.currentState.setContext(this);;
	}
	//行为委托
	public void handle1(){
		this.currentState.handle1();
	}
	public void handle2(){
		this.currentState.handle2();
	}
	
}
